#include "vector.h"
// #include <algorithm>
#include <iostream>
// #include <vector>

template<class Container>
void print(const Container &con)
{
    for (const auto &e : con)
    {
        std::cout << e << " ";
    }
    std::cout << "\n";
}
void test_vector()
{
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(3);
    v.push_back(4);
    // v.push_back(5);

    for (size_t i = 0; i < v.size(); i++)
    {
        std::cout << v[i] << " ";
    }
    std::cout << "\n";
    print(v);
    v.insert(v.begin(), 0);
    print(v);
    v.insert(v.begin() + 2, 0);
    print(v);
}
void test_vector2()
{
    // std::vector<int> v;
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(3);
    v.push_back(4);
    v.push_back(5);
    print(v);
    v.erase(v.begin());
    print(v);
    // int x;
    // std::cin >> x;
    auto it = v.begin();
    // while (it != v.end())
    // {
    //     if (*it % 2 == 0)
    //         v.erase(it);
    //     ++it;
    // }
    while (it != v.end())
    {
        if (*it % 2 == 0)
            it = v.erase(it);
        else
            ++it;
    }
    print(v);
}
#include <vector>
void test_vector3()
{
    // std::vector<int> v;
    vector<int> v;
    v.push_back(1);
    v.push_back(2);
    v.push_back(3);
    v.push_back(4);
    v.push_back(5);
    print(v);
    v.resize(7);
    print(v);
    vector<int> v2 = {1, 2, 3, 4, 5};
    print(v2);
    vector<int> v3(v2.begin() + 1, v2.end() - 1);
    std::string s = "hello, world";
    vector<int> v4(s.begin(), s.end());
    print(v4);
    vector<size_t> v5(10, 1);
    print(v5);
}
void test_vector4()
{
    vector<std::string> vs;
    vs.push_back("1111111111111111111111");
    vs.push_back("1111111111111111111111");
    vs.push_back("1111111111111111111111");
    vs.push_back("1111111111111111111111");
    vs.push_back("1111111111111111111111");
    print(vs);
}
int main()
{
    test_vector3();
    return 0;
}